package com.iterator.service.web.staticalReports;


import com.iterator.mapper.web.staticalReports.StatMapper;
import com.iterator.bean.web.lyh.vo.StatGoodsVORows;
import com.iterator.bean.web.lyh.vo.StatOrderVORows;
import com.iterator.bean.web.lyh.vo.StatUserVORows;
import com.iterator.bean.web.lyh.vo.StatVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatServiceImpl implements StatService {

    @Autowired
    StatMapper statMapper;

    @Override
    public StatVO getUserStat() {
        StatVO statUserVO = new StatVO();

        statUserVO.setColumns(new String[]{"day","users"});

        List<StatUserVORows> rows = statMapper.getUserStat();
        statUserVO.setRows(rows);

        return statUserVO;
    }

    @Override
    public StatVO getOrderStat() {
        StatVO statUserVO = new StatVO();

        statUserVO.setColumns(new String[]{"day","orders","customers","amount","pcr"});

        List<StatOrderVORows> rows = statMapper.getOrderStat();
        statUserVO.setRows(rows);

        return statUserVO;
    }

    @Override
    public StatVO getGoodsStat() {
        StatVO statUserVO = new StatVO();

        statUserVO.setColumns(new String[]{"day","orders","products","amount"});

        List<StatGoodsVORows> rows = statMapper.getGoodsStat();
        statUserVO.setRows(rows);

        return statUserVO;
    }
}
